//app.js
App({
  onLaunch: function () {
    // 展示本地存储能力
    var logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)

    // 登录
    wx.login({
      success: res => {
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
        wx.request({
          url: this.globalData.wx_url1 + res.code + this.globalData.wx_url2,
          success: res => {
            this.globalData.openid = res.data.openid;
          }
        })
      }
    })
    // 获取用户信息
    wx.getSetting({
      success: res => {

      }
    })
  },
  globalData: {
    userInfo: null,
    wx_url1:'https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=',
    wx_url2:'&grant_type=authorization_code',
    // 119.29.162.33 192.168.3.11
    net: 'http://192.168.3.11:7001',
    uid: 0,
  }
})
